package com.example.oauth2.config.exception;

/**
 * @description： 自定义异常抛出
 * @author: xuwenqian
 * @date: 2020/4/16 10:45
 */
public class ApplicationException extends RuntimeException {

    private static final long serialVersionUID = 1L;
    private int errorCode;
    private String errorMessage;

    public ApplicationException() {
        this.errorCode = -1;
    }

    public ApplicationException(String errorMessage) {
        super(errorMessage);
        this.errorCode = -1;
        this.errorMessage = errorMessage;
    }

    public ApplicationException(int errorCode, String errorMessage) {
        super(errorMessage);
        this.errorCode = errorCode;
        this.errorMessage = errorMessage;
    }

    public ApplicationException(String errorMessage, Throwable cause) {
        super(errorMessage, cause);
        this.errorCode = -1;
        this.errorMessage = errorMessage;
    }

    public ApplicationException(int errorCode, String errorMessage, Throwable cause) {
        super(errorMessage, cause);
        this.errorCode = errorCode;
        this.errorMessage = errorMessage;
    }

    public ApplicationException(Throwable cause) {
        super(cause);
        this.errorCode = -1;
    }

    public int getErrorCode() {
        return this.errorCode;
    }

    public void setErrorCode(int errorCode) {
        this.errorCode = errorCode;
    }

    public String getErrorMessage() {
        return this.errorMessage;
    }

    public void setErrorMessage(String errorMessage) {
        this.errorMessage = errorMessage;
    }
}
